package com.jjb.www.ui.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;

import com.hjq.shape.view.ShapeImageView;
import com.jjb.www.R;
import com.jjb.www.bean.BannerBean;
import com.jjb.www.http.glide.GlideApp;
import com.youth.banner.adapter.BannerAdapter;

import java.util.List;

/**
 * Author: lkw
 * time:   2021/11/17 15:19
 * des:    电子准考证banner适配器
 */
public class BannerHomeListAdapter extends BannerAdapter<BannerBean, BannerHomeListAdapter.ImageTitleHolder> {

    private final Context mContext;

    public BannerHomeListAdapter(Context context, List<BannerBean> datas) {
        super(datas);
        this.mContext = context;
    }

    @Override
    public ImageTitleHolder onCreateHolder(ViewGroup parent, int viewType) {

        return new ImageTitleHolder(LayoutInflater.from(mContext).inflate(R.layout.item_home_banner, parent, false));
    }

    @Override
    public void onBindView(ImageTitleHolder holder, BannerBean data, int position, int size) {
        GlideApp.with(mContext)
                .asBitmap()
                .load(data.getImg())
                .into(holder.mImgView);
//        holder.title.setText(data.getTitle());
    }

    public static class ImageTitleHolder extends RecyclerView.ViewHolder {
        private ShapeImageView mImgView;

        public ImageTitleHolder(@NonNull View view) {
            super(view);
            mImgView = view.findViewById(R.id.imgView);

        }
    }
}
